<?php
getHeader();

if (isset($_POST['userNickname']))
{
	$person = userProf::getUserByUid((int)$_SESSION['uid']);
	$person->nickName = $_POST['userNickname'];
	$person->sex = $_POST['userSex'];
	$person->email = $_POST['userEmail'];
	$person->college = $_POST['userCollege'];
	$person->pro = $_POST['userPro'];
	$person->grade = $_POST['userGrade'];
	$person->class = $_POST['userClass'];
	$person->tag = $_POST['userTag'];
	$person->introduction = $_POST['userIntroduction'];
	if ($person->update())
	{
		?>
<div id="content">
<div class="tabs headTabs"><span>修改成功</span></div>
<div class="dataList"><span>&nbsp;&nbsp;&nbsp;&nbsp;信息修改成功, 点击<a
	href="?p=viewUser">这里</a>查看修改后信息.</span></div>
</div>
		<?php
	}
	else
	{
		?>
<div id="content">
<div class="tabs headTabs"><span>修改失败</span></div>
<div class="dataList"><span>&nbsp;&nbsp;&nbsp;&nbsp;资料修改失败, 请联系管理员处理.</span>
</div>
</div>
		<?php
	}
}
else if (isset($_SESSION['authPassed']))
{
	$person = userProf::getUserByUid((int)$_SESSION['uid']);
	?>
<div id="content">
<div class="tabs headTabs"><span>修改我的信息</span></div>
<div class="dataList">
<ul>
	<form action='?p=editProfile' method='post' name='editProfileForm'
		id='editProfileForm'>
	<li>昵称: <input type="text" name="userNickname" id="userNickname"
		value='<?php echo $person->nickName; ?>' /></li>
	<li>性别: <select name="userSex" id="userSex">
		<option value=" "
		<?php if ($person->sex == "") echo "selected='selected'";?>></option>
		<option value="男"
		<?php if ($person->sex == "男") echo "selected='selected'";?>>男</option>
		<option value="女"
		<?php if ($person->sex == "女") echo "selected='selected'";?>>女</option>
	</select></li>
	<li>Email: <input type="text" name="userEmail" id="userEmail"
		value='<?php echo $person->email;?>' /></li>
	<li>院系: <input type="text" name="userCollege" id="userCollege"
		value='<?php echo $person->college;?>' /></li>
	<li>专业: <input type="text" name="userPro" id="userPro"
		value='<?php echo $person->pro;?>' /></li>
	<li>年级: <input type="text" name="userGrade" id="userGrade"
		value='<?php echo $person->grade;?>' /></li>
	<li>班级: <input type="text" name="userClass" id="userClass"
		value='<?php echo $person->class;?>' /></li>
	<li>个人标签: <input type="text" name="userTag" id="userTag"
		value='<?php echo $person->tag;?>' /><span>多个标签以半角逗号","分开</span></li>
	<li>个人介绍: <textarea rows="3" cols="20" name="userIntroduction"
		id="userIntroduction"><?php echo $person->introduction;?></textarea></li>
	<li><input type="submit" value="提交修改" class="button" /></li>
	</form>
</ul>
</div>
</div>
		<?php
}
getPanel();
getFooter();
?>
